import { SchemaNodeKey } from "@/utils/constants";
import SelectDeptList from "../../SelectDeptList";
import { ComponentInternalInstance, getCurrentInstance } from "vue";
/**
 * 简单、相对固定的基础信息：scheme中的basic部分字段，
 */
//根据Schema绘制基本信息
export default defineComponent({
	props: {
		visible: {
			type: Boolean,
			default() {
				return false;
			}
		}
	},
	emits: [],
	setup(props) {
		// const schema = inject<any>(SchemaNodeKey.schema);
		// const profile = inject<any>(SchemaNodeKey.profile);
		const { proxy } = getCurrentInstance() as ComponentInternalInstance;
		const detailInfo = inject<any>(SchemaNodeKey.detailInfo);
		return () => {
			return (
				<>
					<div class="block-simple pt-4 pb-4">
						<div class="grid grid-cols-4">
							<div class="flex item">
								<div class="info-title text-right w-1/3">SN</div>
								<div class="info-text flex-1"> {detailInfo.detail?.sn} </div>
							</div>
							<div class="flex item">
								<div class="info-title text-right w-1/3">{proxy?.$t("simpleinfo.tablist_label.name")}</div>
								<div class="info-text flex-1"> {detailInfo.detail?.name || "--"} </div>
							</div>
							<div class="flex item">
								<div class="info-title text-right w-1/3">{proxy?.$t("simpleinfo.tablist_label.type")}</div>
								<div class="info-text flex-1"> {detailInfo.detail?.type || "--"} </div>
							</div>
							<div class="flex item">
								<div class="info-title text-right w-1/3">{proxy?.$t("simpleinfo.tablist_label.group")}</div>
								<div class="info-text flex-1">
									{props.visible ? <SelectDeptList detail={detailInfo.detail} /> : detailInfo.detail.deptName || "--"}
								</div>
							</div>
						</div>
					</div>
				</>
			);
		};
	}
});
